/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.informet.ipd.modelo.dao;

import com.informet.ipd.modelo.vo.PTareaActMVO;
import com.informet.ipd.modelo.vo.PTareaActVO;
import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
import javax.swing.JOptionPane;

/**
 *
 * @author LAPTOP01
 */
public class PTareaActDao  extends DBase{




    Connection conn = null;

    public PTareaActDao() {

    super();
    }



    private void setPTareaAct(PTareaActVO bean, ResultSet rs) throws SQLException {
   bean.setNUM_PRESATA_PK(rs.getInt("NUM_PRESATA_PK"));
   bean.setSemestreI(rs.getDouble("SemestreI"));
   bean.setSemestreII(rs.getDouble("SemestreII"));
   bean.setPPto_Anual(rs.getDouble("PPto_Anual"));

   bean.setNUM_MES1MEATA(rs.getDouble("NUM_MES1PRESATA"));
   bean.setNUM_MES2MEATA(rs.getDouble("NUM_MES2PRESATA"));
   bean.setNUM_MES3MEATA(rs.getDouble("NUM_MES3PRESATA"));
   bean.setNUM_MES4MEATA(rs.getDouble("NUM_MES4PRESATA"));
   bean.setNUM_MES5MEATA(rs.getDouble("NUM_MES5PRESATA"));
   bean.setNUM_MES6MEATA(rs.getDouble("NUM_MES6PRESATA"));
   bean.setNUM_MES7MEATA(rs.getDouble("NUM_MES7PRESATA"));
   bean.setNUM_MES8MEATA(rs.getDouble("NUM_MES8PRESATA"));
   bean.setNUM_MES9MEATA(rs.getDouble("NUM_MES9PRESATA"));
   bean.setNUM_MES10MEATA(rs.getDouble("NUM_MES10PRESATA"));
   bean.setNUM_MES11MEATA(rs.getDouble("NUM_MES11PRESATA"));
   bean.setNUM_MES12MEATA(rs.getDouble("NUM_MES12PRESATA"));
    }

    private void setMuestraP(PTareaActVO bean, ResultSet rs) throws SQLException {
        bean.setNUM_PRESATA_PK(rs.getInt("NUM_PRESATA_PK"));
        //bean.setTotal(rs.getDouble("total"));
    }


    private void setMuestraPMod(PTareaActVO bean, ResultSet rs) throws SQLException {
        bean.setNUM_PRESATA_PK(rs.getInt("NUM_PRESATAM_PK"));
        //bean.setTotal(rs.getDouble("total"));
    }

    private void setPresupmax(PTareaActVO bean, ResultSet rs) throws SQLException {
   bean.setNUM_PRESATA_PK(rs.getInt("NUM_PRESATA_PK"));
    }

    private void setPresupmaxx(PTareaActMVO bean, ResultSet rs) throws SQLException {
   bean.setNUM_CODATAREAM_PK(rs.getInt("NUM_CODATAREAM_PK"));
    }

    



    private void setPTareaAct(PTareaActMVO bean, ResultSet rs) throws SQLException {
   bean.setNUM_PRESATAM_PK(rs.getInt("NUM_PRESATAM_PK"));
   bean.setSemestreI(rs.getDouble("SemestreI"));
   bean.setSemestreII(rs.getDouble("SemestreII"));
   bean.setPPto_Anual(rs.getDouble("PPto_Anual"));

   bean.setNUM_MES1MEATAM(rs.getDouble("NUM_MES1PRESATAM"));
   bean.setNUM_MES2MEATAM(rs.getDouble("NUM_MES2PRESATAM"));
   bean.setNUM_MES3MEATAM(rs.getDouble("NUM_MES3PRESATAM"));
   bean.setNUM_MES4MEATAM(rs.getDouble("NUM_MES4PRESATAM"));
   bean.setNUM_MES5MEATAM(rs.getDouble("NUM_MES5PRESATAM"));
   bean.setNUM_MES6MEATAM(rs.getDouble("NUM_MES6PRESATAM"));
   bean.setNUM_MES7MEATAM(rs.getDouble("NUM_MES7PRESATAM"));
   bean.setNUM_MES8MEATAM(rs.getDouble("NUM_MES8PRESATAM"));
   bean.setNUM_MES9MEATAM(rs.getDouble("NUM_MES9PRESATAM"));
   bean.setNUM_MES10MEATAM(rs.getDouble("NUM_MES10PRESATAM"));
   bean.setNUM_MES11MEATAM(rs.getDouble("NUM_MES11PRESATAM"));
   bean.setNUM_MES12MEATAM(rs.getDouble("NUM_MES12PRESATAM"));
    }


      private void setMActividadCombo(PTareaActVO bean, ResultSet rs) throws SQLException {
//        bean.setNUM_CODACTPER_PK(rs.getInt("NUM_CODACTPER_PK"));
//        bean.setNUM_CODMETAAPER_PK(rs.getInt("NUM_CODMETAAPER_PK"));
//        bean.setTX_UMACTPER(rs.getString("TX_UMACTPER"));
//        bean.setNUM_CANTACTPER(rs.getInt("NUM_CANTACTPER"));
//        bean.setTX_TIPOACTPER(rs.getString("TX_TIPOACTPER"));
  }



    public String spMan(int tipo, PTareaActVO bean) {
        String msj = "";
        try {
            conn = DriverManager.getConnection(url, usuario, password);
            CallableStatement cs = conn.prepareCall("{call Man_ME_PRESATA(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}");
            cs.setInt(1, tipo);
            cs.setDouble(2, bean.getNUM_PRESATA_PK());
            cs.setDouble(3, bean.getNUM_CODATAREA_PK());
            cs.setDouble(4, bean.getNUM_MES1MEATA());
            cs.setDouble(5, bean.getNUM_MES2MEATA());
            cs.setDouble(6, bean.getNUM_MES3MEATA());
            cs.setDouble(7, bean.getNUM_MES4MEATA());
            cs.setDouble(8, bean.getNUM_MES5MEATA());
            cs.setDouble(9, bean.getNUM_MES6MEATA());
            cs.setDouble(10, bean.getNUM_MES7MEATA());
            cs.setDouble(11, bean.getNUM_MES8MEATA());
            cs.setDouble(12, bean.getNUM_MES9MEATA());
            cs.setDouble(13, bean.getNUM_MES10MEATA());
            cs.setDouble(14, bean.getNUM_MES11MEATA());
            cs.setDouble(15, bean.getNUM_MES12MEATA());
            
            cs.execute();



        } catch (Exception e) {
          JOptionPane.showMessageDialog(null, e.toString());
            return msj;
        }
        return msj;
    }





    public String spManM(int tipo, PTareaActMVO bean) {
        String msj = "";
        try {
            conn = DriverManager.getConnection(url, usuario, password);
            CallableStatement cs = conn.prepareCall("{call Man_ME_PRESATAM(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}");
            cs.setInt(1, tipo);
            cs.setDouble(2, bean.getNUM_PRESATAM_PK());
            cs.setDouble(3, bean.getNUM_CODATAREAM_PK());
            cs.setDouble(4, bean.getNUM_MES1MEATAM());
            cs.setDouble(5, bean.getNUM_MES2MEATAM());
            cs.setDouble(6, bean.getNUM_MES3MEATAM());
            cs.setDouble(7, bean.getNUM_MES4MEATAM());
            cs.setDouble(8, bean.getNUM_MES5MEATAM());
            cs.setDouble(9, bean.getNUM_MES6MEATAM());
            cs.setDouble(10, bean.getNUM_MES7MEATAM());
            cs.setDouble(11, bean.getNUM_MES8MEATAM());
            cs.setDouble(12, bean.getNUM_MES9MEATAM());
            cs.setDouble(13, bean.getNUM_MES10MEATAM());
            cs.setDouble(14, bean.getNUM_MES11MEATAM());
            cs.setDouble(15, bean.getNUM_MES12MEATAM());

            cs.execute();



        } catch (Exception e) {
          JOptionPane.showMessageDialog(null, e.toString());
            return msj;
        }
        return msj;
    }



    /*public String spManMo(int tipo, PTareaActMVO bean) {
        String msj = "";
        try {
            conn = DriverManager.getConnection(url, usuario, password);
            CallableStatement cs = conn.prepareCall("{call Man_ME_PRESATAMO(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}");
            cs.setInt(1, tipo);
            cs.setDouble(2, bean.getNUM_PRESATAM_PK());
            cs.setDouble(3, bean.getNUM_CODATAREAM_PK());
            cs.setDouble(4, bean.getNUM_MES1MEATAM());
            cs.setDouble(5, bean.getNUM_MES2MEATAM());
            cs.setDouble(6, bean.getNUM_MES3MEATAM());
            cs.setDouble(7, bean.getNUM_MES4MEATAM());
            cs.setDouble(8, bean.getNUM_MES5MEATAM());
            cs.setDouble(9, bean.getNUM_MES6MEATAM());
            cs.setDouble(10, bean.getNUM_MES7MEATAM());
            cs.setDouble(11, bean.getNUM_MES8MEATAM());
            cs.setDouble(12, bean.getNUM_MES9MEATAM());
            cs.setDouble(13, bean.getNUM_MES10MEATAM());
            cs.setDouble(14, bean.getNUM_MES11MEATAM());
            cs.setDouble(15, bean.getNUM_MES12MEATAM());

            cs.execute();



        } catch (Exception e) {
          JOptionPane.showMessageDialog(null, e.toString());
            return msj;
        }
        return msj;
    }*/

    public ArrayList<PTareaActVO> selectLista() throws SQLException {

        Statement stmt = null;
        ResultSet rs = null;
        ArrayList<PTareaActVO> lista = new ArrayList<PTareaActVO>(0);
        //lista=null;
        String sql = "";
        try {
            conn = DriverManager.getConnection(url, usuario, password);
            stmt = conn.createStatement();
            sql = "select NUM_CODMETAAPER_PK,TX_UMACTPER from ME_METAAPER";
            rs = stmt.executeQuery(sql);
            PTareaActVO bean = null;
            while (rs.next()) {
                bean = new PTareaActVO();
                setPTareaAct(bean, rs);
                lista.add(bean);
            }

        } finally {
            if (rs != null) {
                rs.close();
                rs = null;
            }
            if (stmt != null) {
                stmt.close();
                stmt = null;
            }
            if (conn != null) {
                conn.close();
                conn = null;
            }

        }
        return lista;
    }


    public int getMuestrapTarea(int id) throws SQLException {
        PreparedStatement pstmt = null;
        Statement stmt = null;
        ResultSet rs = null;
        ArrayList<PTareaActVO> lista = new ArrayList<PTareaActVO>(0);
        int numero=0;
        //lista=null;
        String sql = "";
        try {
            conn = DriverManager.getConnection(url, usuario, password);
            sql = "select NUM_PRESATA_PK from ME_PRESATA WHERE NUM_CODATAREA_PK=?";
            pstmt = conn.prepareStatement(sql);
            pstmt.setInt(1, id);
            rs = pstmt.executeQuery();
            PTareaActVO bean = null;
            while (rs.next()) {
                bean = new PTareaActVO();
                setMuestraP(bean, rs);
                lista.add(bean);
                numero=1;
            }
            rs.close();
            pstmt.close();
        } finally {
            if (rs != null) {
                rs.close();
                rs = null;
            }
            if (stmt != null) {
                stmt.close();
                stmt = null;
            }
            if (conn != null) {
                conn.close();
                conn = null;
            }

        }
        return numero;
    }

    public int getMuestrapTareaMod(int id) throws SQLException {
        PreparedStatement pstmt = null;
        Statement stmt = null;
        ResultSet rs = null;
        ArrayList<PTareaActVO> lista = new ArrayList<PTareaActVO>(0);
        int numero=0;
        //lista=null;
        String sql = "";
        try {
            conn = DriverManager.getConnection(url, usuario, password);
            sql = "select NUM_PRESATAM_PK from ME_PRESATAM WHERE NUM_CODATAREA_PK=?";
            pstmt = conn.prepareStatement(sql);
            pstmt.setInt(1, id);
            rs = pstmt.executeQuery();
            PTareaActVO bean = null;
            while (rs.next()) {
                bean = new PTareaActVO();
                setMuestraPMod(bean, rs);
                lista.add(bean);
                numero=1;
            }
            rs.close();
            pstmt.close();
        } finally {
            if (rs != null) {
                rs.close();
                rs = null;
            }
            if (stmt != null) {
                stmt.close();
                stmt = null;
            }
            if (conn != null) {
                conn.close();
                conn = null;
            }

        }
        return numero;
    }



    public List getlist() throws SQLException {

        Statement stmt = null;
        ResultSet rs = null;
        ArrayList<PTareaActVO> lista = new ArrayList<PTareaActVO>(0);
        //lista=null;
        String sql = "";
        try {
            conn = DriverManager.getConnection(url, usuario, password);
            stmt = conn.createStatement();
            sql = "select NUM_CODMETAAPER_PK,TX_UMACTPER from ME_METAAPER";
            rs = stmt.executeQuery(sql);
            PTareaActVO bean = null;
            while (rs.next()) {
                bean = new PTareaActVO();
                setPTareaAct(bean, rs);
                lista.add(bean);
            }

        } finally {
            if (rs != null) {
                rs.close();
                rs = null;
            }
            if (stmt != null) {
                stmt.close();
                stmt = null;
            }
            if (conn != null) {
                conn.close();
                conn = null;
            }

        }
        return lista;
    }

    public PTareaActVO selectById(double id) throws SQLException {
        PreparedStatement pstmt = null;
        ResultSet rs = null;
      
        PTareaActVO bean = null;
        try {
            conn = DriverManager.getConnection(url, usuario, password);
            String sql = "select NUM_PRESATA_PK,sum(NUM_MES1PRESATA+NUM_MES2PRESATA+NUM_MES3PRESATA+NUM_MES4PRESATA+NUM_MES5PRESATA+NUM_MES6PRESATA+NUM_MES7PRESATA+NUM_MES8PRESATA+NUM_MES9PRESATA+NUM_MES10PRESATA+NUM_MES11PRESATA+NUM_MES12PRESATA) as PPto_Anual,sum(NUM_MES1PRESATA+NUM_MES2PRESATA+NUM_MES3PRESATA+NUM_MES4PRESATA+NUM_MES5PRESATA+NUM_MES6PRESATA) as SemestreI,sum(NUM_MES7PRESATA+NUM_MES8PRESATA+NUM_MES9PRESATA+NUM_MES10PRESATA+NUM_MES11PRESATA+NUM_MES12PRESATA) as SemestreII from dbo.ME_PRESATA where NUM_CODATAREA_PK=1" +
                    " group by NUM_PRESATA_PK ";
            pstmt = conn.prepareStatement(sql);
            pstmt.setDouble(1, id);
            rs = pstmt.executeQuery();
            bean = new PTareaActVO();
            if (rs.next()) {
                setPTareaAct(bean, rs);
            }
            rs.close();
            pstmt.close();
        } finally {
            if (rs != null) {
                rs.close();
                rs = null;
            }
            if (pstmt != null) {
                pstmt.close();
                pstmt = null;
            }
            if (conn != null) {
                conn.close();
                conn = null;
            }
        }
        return bean;
    }

     public List getListById(double id) throws SQLException {
        PreparedStatement pstmt = null;
        Statement stmt = null;
        ResultSet rs = null;
        ArrayList<PTareaActVO> lista = new ArrayList<PTareaActVO>(0);
        //lista=null;
        String sql = "";
        try {
            conn = DriverManager.getConnection(url, usuario, password);
              sql = "select NUM_PRESATA_PK,NUM_MES1PRESATA,NUM_MES2PRESATA,NUM_MES3PRESATA,NUM_MES4PRESATA,NUM_MES5PRESATA,NUM_MES6PRESATA,NUM_MES7PRESATA,NUM_MES8PRESATA,NUM_MES9PRESATA,NUM_MES10PRESATA,NUM_MES11PRESATA,NUM_MES12PRESATA,sum(NUM_MES1PRESATA+NUM_MES2PRESATA+NUM_MES3PRESATA+NUM_MES4PRESATA+NUM_MES5PRESATA+NUM_MES6PRESATA+NUM_MES7PRESATA+NUM_MES8PRESATA+NUM_MES9PRESATA+NUM_MES10PRESATA+NUM_MES11PRESATA+NUM_MES12PRESATA) as PPto_Anual,sum(NUM_MES1PRESATA+NUM_MES2PRESATA+NUM_MES3PRESATA+NUM_MES4PRESATA+NUM_MES5PRESATA+NUM_MES6PRESATA) as SemestreI,sum(NUM_MES7PRESATA+NUM_MES8PRESATA+NUM_MES9PRESATA+NUM_MES10PRESATA+NUM_MES11PRESATA+NUM_MES12PRESATA) as SemestreII from dbo.ME_PRESATA where NUM_CODATAREA_PK=?" +
                    " group by NUM_PRESATA_PK,NUM_MES1PRESATA,NUM_MES2PRESATA,NUM_MES3PRESATA,NUM_MES4PRESATA,NUM_MES5PRESATA,NUM_MES6PRESATA,NUM_MES7PRESATA,NUM_MES8PRESATA,NUM_MES9PRESATA,NUM_MES10PRESATA,NUM_MES11PRESATA,NUM_MES12PRESATA ";
            pstmt = conn.prepareStatement(sql);
            pstmt.setDouble(1, id);
            rs = pstmt.executeQuery();
            PTareaActVO bean = null;
            while (rs.next()) {
                bean = new PTareaActVO();
                setPTareaAct(bean, rs);
                lista.add(bean);
            }
            rs.close();
            pstmt.close();
        } finally {
            if (rs != null) {
                rs.close();
                rs = null;
            }
            if (stmt != null) {
                stmt.close();
                stmt = null;
            }
            if (conn != null) {
                conn.close();
                conn = null;
            }

        }
        return lista;
    }


     public int maximo() throws SQLException {

        Statement stmt = null;
        ResultSet rs = null;
        String sql = "";
        int max=0;
        try {
            conn = DriverManager.getConnection(url, usuario, password);
            stmt = conn.createStatement();
            sql = "select max(NUM_PRESATA_PK) AS NUM_PRESATA_PK FROM ME_PRESATA";
            rs = stmt.executeQuery(sql);
            PTareaActVO bean = null;
            while (rs.next()) {
                bean = new PTareaActVO();
                setPresupmax(bean, rs);
                max=bean.getNUM_PRESATA_PK();
            }

        } finally {
            if (rs != null) {
                rs.close();
                rs = null;
            }
            if (stmt != null) {
                stmt.close();
                stmt = null;
            }
            if (conn != null) {
                conn.close();
                conn = null;
            }

        }
        return max;
    }


     public int maximoo() throws SQLException {

        Statement stmt = null;
        ResultSet rs = null;
        String sql = "";
        int max=0;
        try {
            conn = DriverManager.getConnection(url, usuario, password);
            stmt = conn.createStatement();
            sql = "select NUM_CODATAREAM_PK FROM ME_ATAREAM where NUM_CODATAREA_PK=(select max(NUM_CODATAREA_PK) AS NUM_CODATAREA_PK FROM ME_ATAREA)";
            rs = stmt.executeQuery(sql);
            PTareaActMVO bean = null;
            while (rs.next()) {
                bean = new PTareaActMVO();
                setPresupmaxx(bean, rs);
                max=bean.getNUM_CODATAREAM_PK();
            }

        } finally {
            if (rs != null) {
                rs.close();
                rs = null;
            }
            if (stmt != null) {
                stmt.close();
                stmt = null;
            }
            if (conn != null) {
                conn.close();
                conn = null;
            }

        }
        return max;
    }




     




     public List getListByIdM(double id) throws SQLException {
        PreparedStatement pstmt = null;
        Statement stmt = null;
        ResultSet rs = null;
        ArrayList<PTareaActMVO> lista = new ArrayList<PTareaActMVO>(0);
        //lista=null;
        String sql = "";
        try {
            conn = DriverManager.getConnection(url, usuario, password);
              sql = "select NUM_PRESATAM_PK,NUM_MES1PRESATAM,NUM_MES2PRESATAM,NUM_MES3PRESATAM,NUM_MES4PRESATAM,NUM_MES5PRESATAM,NUM_MES6PRESATAM,NUM_MES7PRESATAM,NUM_MES8PRESATAM,NUM_MES9PRESATAM,NUM_MES10PRESATAM,NUM_MES11PRESATAM,NUM_MES12PRESATAM,sum(NUM_MES1PRESATAM+NUM_MES2PRESATAM+NUM_MES3PRESATAM+NUM_MES4PRESATAM+NUM_MES5PRESATAM+NUM_MES6PRESATAM+NUM_MES7PRESATAM+NUM_MES8PRESATAM+NUM_MES9PRESATAM+NUM_MES10PRESATAM+NUM_MES11PRESATAM+NUM_MES12PRESATAM) as PPto_Anual,sum(NUM_MES1PRESATAM+NUM_MES2PRESATAM+NUM_MES3PRESATAM+NUM_MES4PRESATAM+NUM_MES5PRESATAM+NUM_MES6PRESATAM) as SemestreI,sum(NUM_MES7PRESATAM+NUM_MES8PRESATAM+NUM_MES9PRESATAM+NUM_MES10PRESATAM+NUM_MES11PRESATAM+NUM_MES12PRESATAM) as SemestreII from dbo.ME_PRESATAM where NUM_CODATAREA_PK=? group by NUM_PRESATAM_PK,NUM_MES1PRESATAM,NUM_MES2PRESATAM,NUM_MES3PRESATAM,NUM_MES4PRESATAM,NUM_MES5PRESATAM,NUM_MES6PRESATAM,NUM_MES7PRESATAM,NUM_MES8PRESATAM,NUM_MES9PRESATAM,NUM_MES10PRESATAM,NUM_MES11PRESATAM,NUM_MES12PRESATAM";
            pstmt = conn.prepareStatement(sql);
            pstmt.setDouble(1, id);
            rs = pstmt.executeQuery();
            PTareaActMVO bean = null;
            while (rs.next()) {
                bean = new PTareaActMVO();
                setPTareaAct(bean, rs);
                lista.add(bean);
            }
            rs.close();
            pstmt.close();
        } finally {
            if (rs != null) {
                rs.close();
                rs = null;
            }
            if (stmt != null) {
                stmt.close();
                stmt = null;
            }
            if (conn != null) {
                conn.close();
                conn = null;
            }

        }
        return lista;
    }



     public List getListByIdMod(double id) throws SQLException {
        PreparedStatement pstmt = null;
        Statement stmt = null;
        ResultSet rs = null;
        ArrayList<PTareaActMVO> lista = new ArrayList<PTareaActMVO>(0);
        //lista=null;
        String sql = "";
        try {
            conn = DriverManager.getConnection(url, usuario, password);
              sql = "select NUM_PRESATAM_PK,NUM_MES1PRESATAM,NUM_MES2PRESATAM,NUM_MES3PRESATAM,NUM_MES4PRESATAM,NUM_MES5PRESATAM,NUM_MES6PRESATAM,NUM_MES7PRESATAM,NUM_MES8PRESATAM,NUM_MES9PRESATAM,NUM_MES10PRESATAM,NUM_MES11PRESATAM,NUM_MES12PRESATAM,sum(NUM_MES1PRESATAM+NUM_MES2PRESATAM+NUM_MES3PRESATAM+NUM_MES4PRESATAM+NUM_MES5PRESATAM+NUM_MES6PRESATAM+NUM_MES7PRESATAM+NUM_MES8PRESATAM+NUM_MES9PRESATAM+NUM_MES10PRESATAM+NUM_MES11PRESATAM+NUM_MES12PRESATAM) as PPto_Anual,sum(NUM_MES1PRESATAM+NUM_MES2PRESATAM+NUM_MES3PRESATAM+NUM_MES4PRESATAM+NUM_MES5PRESATAM+NUM_MES6PRESATAM) as SemestreI,sum(NUM_MES7PRESATAM+NUM_MES8PRESATAM+NUM_MES9PRESATAM+NUM_MES10PRESATAM+NUM_MES11PRESATAM+NUM_MES12PRESATAM) as SemestreII from ME_PRESATAM where NUM_CODATAREAM_PK=? group by NUM_PRESATAM_PK,NUM_MES1PRESATAM,NUM_MES2PRESATAM,NUM_MES3PRESATAM,NUM_MES4PRESATAM,NUM_MES5PRESATAM,NUM_MES6PRESATAM,NUM_MES7PRESATAM,NUM_MES8PRESATAM,NUM_MES9PRESATAM,NUM_MES10PRESATAM,NUM_MES11PRESATAM,NUM_MES12PRESATAM";
            pstmt = conn.prepareStatement(sql);
            pstmt.setDouble(1, id);
            rs = pstmt.executeQuery();
            PTareaActMVO bean = null;
            while (rs.next()) {
                bean = new PTareaActMVO();
                setPTareaAct(bean, rs);
                lista.add(bean);
            }
            rs.close();
            pstmt.close();
        } finally {
            if (rs != null) {
                rs.close();
                rs = null;
            }
            if (stmt != null) {
                stmt.close();
                stmt = null;
            }
            if (conn != null) {
                conn.close();
                conn = null;
            }

        }
        return lista;
    }


     public List getCombo(int id) throws SQLException {
        PreparedStatement pstmt = null;
        Statement stmt = null;
        ResultSet rs = null;
        ArrayList<PTareaActVO> lista = new ArrayList<PTareaActVO>(0);
        //lista=null;
        String sql = "";
        try {
            conn = DriverManager.getConnection(url, usuario, password);

            sql = "select TX_UMACTPER,NUM_CANTACTPER,TX_TIPOACTPER,NUM_CODMETAAPER_PK,NUM_CODACTPER_PK from ME_METAAPER where NUM_CODACTPER_PK=?";
            pstmt = conn.prepareStatement(sql);
            pstmt.setInt(1, id);
            rs = pstmt.executeQuery();
            PTareaActVO bean = null;
            while (rs.next()) {
                bean = new PTareaActVO();
                setMActividadCombo(bean, rs);
                lista.add(bean);
            }
            rs.close();
            pstmt.close();
        } finally {
            if (rs != null) {
                rs.close();
                rs = null;
            }
            if (stmt != null) {
                stmt.close();
                stmt = null;
            }
            if (conn != null) {
                conn.close();
                conn = null;
            }

        }
        return lista;
    }



}
